<?php

namespace App\Log\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\File;
use App\Log\Service\ApplogsViewerService;
class ApplogsController extends Controller
{
    
    public function __construct(ApplogsViewerService $repository)
    {
        $this->repository = $repository;
 
    }
    /**
     * @param Request $request
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function home(Request $request)
    {
        $data=[
            'type'=>$request->input("type"),
            'level'=>$request->input("level"),
        ];
        $list = $this->repository->getList($request,$data);
        //dd($list);
        return view('applogs', ['list'=>$list]);
    }
    public function viewindex(Request $request)
    {
        
        $data=[
            'type'=>$request->input("type"),
            'level'=>$request->input("level"),
        ];
        $list = $this->repository->getList($request,$data);
        //dd($list);
        return view('realtime', ['list'=>$list]);
    }
    public function index(Request $request)
    {
        $data=[
            'type'=>$request->input("type"),
            'level'=>$request->input("level"),
        ];
        $list = $this->repository->getList($request,$data);
        return response()->json(['data' => $list]);
    }
   

}
